package com.jigsawapp.movies.ui.fragments;

//import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jigsawapp.movies.R;
import com.jigsawapp.movies.api.MoviesApi;
import com.jigsawapp.movies.bean.Movies;
import com.jigsawapp.movies.util.JsonUtils;
import com.kymjs.rxvolley.client.HttpCallback;

import java.util.List;
import java.util.Map;

/**
 * Created by jigsaw on 2016/1/7.
 * Email: fadeblack307@163.com
 */
public class WeixinFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        MoviesApi.moviesIndex("0", "3", new HttpCallback() {
            @Override
            public void onSuccess(Map<String, String> headers, byte[] t) {
                super.onSuccess(headers, t);
                List<Movies> movies = JsonUtils.getList(Movies[].class, t);
//                Log.d("tag", movies.toString());
                for (Movies b: movies) {
                    Log.d("tag", b.getTitle());
                }

            }

            @Override
            public void onFailure(int errorNo, String strMsg) {
                super.onFailure(errorNo, strMsg);
            }

            @Override
            public void onFinish() {
                super.onFinish();
            }
        });
        return inflater.inflate(R.layout.tab1, container, false);
    }


}
